package org.kealinghornets.jchuah.buttons;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;


public class LEVEL3ACTIVITY extends MainActivity {

    public void checkVictory () {
        View left_arrow = findViewById(R.id.left_arrow);
        View middle_arrow = findViewById(R.id.middle_arrow);
        View right_arrow = findViewById(R.id.right_arrow);
        View mleft_arrow = findViewById(R.id.mleft_arrow);
        View mmiddle_arrow = findViewById(R.id.mmiddle_arrow);
        View mright_arrow = findViewById(R.id.mright_arrow);
        if (left_arrow.getVisibility() == View.INVISIBLE && middle_arrow.getVisibility() == View.INVISIBLE && right_arrow.getVisibility() == View.INVISIBLE && mleft_arrow.getVisibility() == View.INVISIBLE && mmiddle_arrow.getVisibility() == View.INVISIBLE && mright_arrow.getVisibility() == View.INVISIBLE) {
            Toast.makeText(this,"You beat level 3", Toast. LENGTH_LONG).show();

        }
    }

    public void onleft_buttonPush(View view) {
        toggleVisibility(R.id.middle_arrow);
        checkVictory();
    }

    public void onmiddle_buttonPush(View view) {
        toggleVisibility(R.id.left_arrow);
        checkVictory();
    }

    public void onright_buttonPush(View view) {
        toggleVisibility(R.id.right_arrow);
        checkVictory();
    }

    public void onmleft_buttonPush(View view) {
        toggleVisibility(R.id.mleft_arrow);
        checkVictory();
    }

    public void onmmiddle_buttonPush(View view) {
        toggleVisibility(R.id.mright_arrow);
        checkVictory();
    }

    public void onmright_buttonPush(View view) {
        toggleVisibility(R.id.mmiddle_arrow);
        checkVictory();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_level3_activity);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_level3_activity, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
